﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;

namespace XmlServer.Listeners
{
    public class ListenerConfiguration
    {
        private int clientPoolCapacity = 50;    // default to 50
        private int numberOfThreads = 20;       // default to 20

        /// <summary>
        /// The IP Address of the listener
        /// </summary>
        public string IPAddress { get; set; }

        /// <summary>
        /// The port of the listener
        /// </summary>
        public int Port { get; set; }

        /// <summary>
        /// The number of processing threads for the listener
        /// </summary>
        public int NumberOfThreads
        {
            get { return numberOfThreads; }
            set { numberOfThreads = value; }
        }

        /// <summary>
        /// The folder that contains the XML Operators files/DLLs
        /// </summary>
        public string OperatorsFolder { get; set; }


        /// <summary>
        /// the inital capacity of the client pool
        /// </summary>        
        public int ClientPoolCapacity 
        {
            get { return clientPoolCapacity; }
            set { clientPoolCapacity = value; }
        }

        /// <summary>
        /// Get the endpoint for this listener
        /// </summary>
        /// <returns></returns>
        public IPEndPoint GetEndpoint()
        {
            var address = System.Net.IPAddress.Parse(this.IPAddress);
            return new IPEndPoint(address, this.Port);
        }


    }
}
